package com.example.demo.model.goods.goods.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.Results.ResultClass;
import com.example.demo.model.goods.goods.entity.ShopGoods;
import com.example.demo.model.goods.goods.mapper.ShopGoodsDao;
import com.example.demo.model.goods.goods.service.ShopGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author STAHYW
 * @since 2021-10-16
 */
@Service
public class ShopGoodsServiceImpl extends ServiceImpl<ShopGoodsDao, ShopGoods> implements ShopGoodsService {
    @Autowired
    ShopGoodsDao shopGoodsDao;

    @Override
    public ResultClass<List<ShopGoods>> getShopGoods(Integer goodsTypeId) {
        QueryWrapper<ShopGoods> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(ShopGoods::getShopTypeId, goodsTypeId);
        List<ShopGoods> list = shopGoodsDao.selectList(queryWrapper);
        return ResultClass.ok(list);
    }
}
